﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SocketTool
{
    public partial class GlobalContext
    {
        private static object mLockObj = new object();
        private static GlobalContext mCurrent;
        public static GlobalContext Current
        {
            get
            {
                lock (mLockObj)
                {
                    if (mCurrent == null)
                    {
                        lock (mLockObj)
                        {
                            mCurrent = new GlobalContext();
                        }
                    }
                }

                return mCurrent;
            }
        }
        
        public ViewModels.ViewModelLocator VMLocator { get;  set; }


        #region CreateID

        /// <summary>
        /// 生成GUID
        /// </summary>
        /// <returns></returns>
        public string CreateProtocolHeadID()
        {
            return Guid.NewGuid().ToString("N");
        }

        #endregion
    }
    /// <summary>
    /// Simple View Caches
    /// </summary>
    public partial class GlobalContext
    {
        /// <summary>
        /// 协议管理页面
        /// </summary>
        public Views.Protocols.ProtocolManageView CurrentProtocolManageView { get; set; }
    }
}
